From: Marco Trevisan (TreviƱo) Date: Mon, 30 Jun 2025 18:31:13 +0000 (+0200) Subject: network: Do not consider networks without ID as available X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~116^2^2~61 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0e35a3cbdd52f883dff89d0bdce8b909f1f7d7cc;p=gnome-shell.git network: Do not consider networks without ID as available In some rare (and weird) cases network manager may provide us connections without settings (since connection.get_settings() is actually nullable, and this may lead to have a NULL connection ID, that eventually breaks the network menu completely: (gnome-shell:1579214): GNOME Shell-CRITICAL **: 20:27:14.874: Error: Argument str2 may not be null Stack trace: _sortByName@resource:///org/gnome/shell/ui/status/network.js:119:21 lowerBound@resource:///org/gnome/shell/misc/util.js:253:13 insertSorted@resource:///org/gnome/shell/misc/util.js:279:25 _upsert@resource:///org/gnome/shell/ui/status/network.js:128:21 upsert@resource:///org/gnome/shell/ui/status/network.js:147:21 _addConnection@resource:///org/gnome/shell/ui/status/network.js:578:38 _syncConnections@resource:///org/gnome/shell/ui/status/network.js:511:18 NMDeviceItem@resource:///org/gnome/shell/ui/status/network.js:469:14 NMWiredDeviceItem@resource:///org/gnome/shell/ui/status/network.js:611:1 _createDeviceMenuItem@resource:///org/gnome/shell/ui/status/network.js:1909:16 _ensureDeviceItem@resource:///org/gnome/shell/ui/status/network.js:1744:27 _syncDeviceItem@resource:///org/gnome/shell/ui/status/network.js:1717:18 _addDevice@resource:///org/gnome/shell/ui/status/network.js:1767:14 _loadInitialItems@resource:///org/gnome/shell/ui/status/network.js:1680:18 setClient@resource:///org/gnome/shell/ui/status/network.js:1420:18 setClient@resource:///org/gnome/shell/ui/status/network.js:1651:15 _getClient/<@resource:///org/gnome/shell/ui/status/network.js:2126:30 _getClient@resource:///org/gnome/shell/ui/status/network.js:2125:33 async*_init@resource:///org/gnome/shell/ui/status/network.js:2119:14 SystemIndicator@resource:///org/gnome/shell/ui/quickSettings.js:847:1 Indicator@resource:///org/gnome/shell/ui/status/network.js:2073:1 _setupIndicators@resource:///org/gnome/shell/ui/panel.js:523:29 async*QuickSettings@resource:///org/gnome/shell/ui/panel.js:514:14 _ensureIndicator@resource:///org/gnome/shell/ui/panel.js:903:25 _updateBox@resource:///org/gnome/shell/ui/panel.js:914:34 _updatePanel@resource:///org/gnome/shell/ui/panel.js:868:14 _init@resource:///org/gnome/shell/ui/panel.js:692:14 Panel@resource:///org/gnome/shell/ui/panel.js:648:1 _initializeUI@resource:///org/gnome/shell/ui/main.js:246:13 start@resource:///org/gnome/shell/ui/main.js:180:11 @resource:///org/gnome/shell/ui/init.js:12:47 @resource:///org/gnome/shell/ui/init.js:21:20 Now, despite that specific connection here has valid settings when loaded from dbus, it may still happen that NM lib fails at other level in fetching its settings. That said, we should not fail if a connection has no settings, and just skip it. Part-of: --- diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 4b5ff4725..4cabfda65 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -500,7 +500,8 @@ const NMDeviceItem = GObject.registerClass({ } _syncConnections() { - const available = this._device.get_available_connections(); + const available = this._device.get_available_connections().filter( + c => c.get_id() != null); const removed = [...this._connectionItems.keys()] .filter(conn => !available.includes(conn));